package cn.tedu.imop.basic.controller;

import cn.tedu.imop.api.model.RestResult;
import cn.tedu.imop.api.model.RestResultUtils;
import cn.tedu.imop.basic.entity.TagLibrary;
import cn.tedu.imop.basic.service.TagLibraryService;
import cn.tedu.imop.common.constants.Constants;
import cn.tedu.imop.common.pojo.PageData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags="标签库管理")
@RestController
@RequestMapping(Constants.CONTROLLER_API_VERSION+"/tagLibrary")
public class TagLibraryController {
    private TagLibraryService tagLibraryService;
    public TagLibraryController(TagLibraryService tagLibraryService) {
        this.tagLibraryService = tagLibraryService;
    }
    @ApiOperation("标签库列表")
    @GetMapping
    public RestResult<PageData<TagLibrary>> getTagLibraryList(TagLibrary tagLibrary) {
        return RestResultUtils.success(tagLibraryService.getTagLibraryList(tagLibrary));
    }
    @ApiOperation("创建标签库")
    @PostMapping
    public RestResult<Boolean> createTagLibrary(TagLibrary tagLibrary) {
        tagLibraryService.createTagLibrary(tagLibrary);
        return RestResultUtils.success();
    }
}
